//
//  WaitingView.m
//  Hxcsfw
//
//  Created by 企友软mac on 2017/11/28.
//  Copyright © 2017年 企友软mac. All rights reserved.
//

#import "WaitingView.h"
#import "GifView.h"

@interface WaitingView()

@property (nonatomic,strong) UIActivityIndicatorView *activityIndicator;

@end

@implementation WaitingView

-(id)initWithFrame:(CGRect)frame tag:(NSInteger)tag{

    if (self =[super initWithFrame:frame]) {
        self.backgroundColor =[UIColor clearColor];
        self.tag = tag;
//        _activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake((frame.size.width - 20) * 0.5, (frame.size.height - 20) * 0.5, 20, 20)];
//        _activityIndicator.backgroundColor = [UIColor redColor];
//        [_activityIndicator startAnimating]; // 开始旋转
//        [self addSubview:_activityIndicator];

        self.contentView =[[UIImageView alloc] initWithFrame:CGRectMake((frame.size.width-50)/2, (frame.size.height-50)/2, 50, 50)];
        _contentView.backgroundColor =[UIColor clearColor];
        //        _contentView.layer.cornerRadius =5.0;
        [self addSubview:_contentView];

        if ([WShareUtil sharedData].isShowWait) {
            // 本地gif图片（旋转菊花）
            NSData *localData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Preloader_2" ofType:@"gif"]];

            GifView *dataView = [[GifView alloc] initWithFrame:CGRectMake(15 * 0.5, 15 * 0.5, 35, 35) data:localData];
            [self.contentView addSubview:dataView];
        }                                                               

//        self.contentView.animationImages = [NSArray arrayWithObjects:[UIImage imageNamed:@"imgofwaitview48.png"],
//                                            [UIImage imageNamed:@"shouyewangshangjiaofei.png"],
//                                            [UIImage imageNamed:@"shouyexiaoqiehuan1.png"],
//                                            [UIImage imageNamed:@"shouyewangshangjiaofei.png"],
//                                            [UIImage imageNamed:@"shouyexiaoqiehuan1.png"],
//                                            nil];
//        [self.contentView setAnimationDuration:3.0];
//        [self.contentView setAnimationRepeatCount:9999];
    }
    return self;
}

@end
